******************************
*Ryan Thombs
*LEED Schools SPI and Discipline 
******************************

*Clear the system
capture log close
clear
set more off

use E:\LEED.dta 


describe
sum
sum if Treatment==0
sum if Treatment==1
ttest SPI, by (Treatment) 
ttest PercentEconDis, by (Treatment)
ttest Attendance, by (Treatment)
ttest Enrollment, by (Treatment)
ttest Female, by (Treatment)
ttest Black, by (Treatment)
ttest White, by (Treatment)
ttest Hispanic, by (Treatment)
ttest PerPupilExpenditureClassroom, by (Treatment)
ttest MedianTeacherSalary, by (Treatment)
ttest StudentsperTeacherFTEEnroll, by (Treatment)
ttest Discipline, by (Treatment)

******Skewness******
swilk SPI PercentEconDis Attendance Enrollment Female Black White Hispanic PerPupilExpenditureClassroom MedianTeacherSalary StudentsperTeacherFTEEnroll Discipline
gen lnSPI= ln(SPI)
gen lnecon= ln(PercentEconDis)
gen lnatt= ln(Attendance)
gen lnenroll= ln(Enrollment)
gen lnF= ln(Female)
gen lnB= ln(Black)
gen lnW= ln(White)
gen lnH= ln(Hispanic)
gen lnexp= ln(PerPupilExpenditureClassroom)
gen lnsalary= ln(MedianTeacherSalary)
gen lnStuTeach= ln(StudentsperTeacherFTEEnroll)
gen lnD= ln(Discipline)


****Analysis***
xtset school Year, yearly
xtreg lnSPI lnF lnexp lnStuTeach LEED Treatment LEED##Treatment i.school i.Year
xtserial lnSPI lnF lnexp lnStuTeach LEED Treatment
xtpcse lnSPI lnF lnexp lnStuTeach LEED Treatment LEED##Treatment i.school i.Year,correlation(ar1)
gen placebo= 1 if Year>=2013
replace placebo=0 if Year<2013
xtpcse lnSPI lnF lnexp lnStuTeach placebo Treatment placebo##Treatment i.school i.Year,correlation(ar1)
gen p2= 1 if Year>=2010 
replace p2= 0 if Year<2010
xtpcse lnSPI lnF lnexp lnStuTeach p2 Treatment p2##Treatment i.school i.Year,correlation(ar1)
gen p3= 1 if Year>=2011
replace p3=0 if Year<2011
xtpcse lnSPI lnF lnexp lnStuTeach p3 Treatment p3##Treatment i.school i.Year,correlation(ar1)
graph twoway (lfit SPI Year if Treatment==1)(lfit SPI Year if Treatment==0), xline (2012)


